package cn.com.nes.site.controller.crm.customer.vo;

import cn.com.nes.site.entity.em.crm.customer.CustomerFileTypeEnum;
import cn.com.nes.site.entity.vo.PageVO;
import cn.com.nes.site.service.crm.customer.bo.CustomerFileBO;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotNull;

@ApiModel(value = "客户文件分页查询入参模型")
@Data
public class CustomerFilePageVO extends PageVO {

    @ApiModelProperty(value = "客户UUID", required = true)
    @NotNull(message = "客户UUID")
    private String customerUuid;

    @ApiModelProperty(value = "文件类型")
    private String fileType;

    public CustomerFileBO convertToBo() {
        CustomerFileBO customerFileBo = new CustomerFileBO();
        BeanUtils.copyProperties(this, customerFileBo);
        if (StrUtil.isNotEmpty(fileType)) {
            customerFileBo.setCustomerFileType(CustomerFileTypeEnum.getEnum(fileType));
        }
        return customerFileBo;
    }
}
